<template>
  <div class="singer_cotainer">
    <div class="singer_wrap">
      <div
        v-for="(item, index) in singerList.slice(0, 6)"
        :key="index"
        class="item"
      >
        <el-image
        lazy
          @click="toDetail(item.id)"
          :src="item.img1v1Url"
          fit="cover"
        ></el-image>
        <div class="name">{{ item.name }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { getRecSinger } from "@/util/music.js";
export default {
  name: "Recommentsinger",

  data() {
    return {
      singerList: [],
    };
  },

  mounted() {
    this.getRecSinger();
  },

  methods: {
    //   获取歌手推荐
    async getRecSinger() {
      let { data } = await getRecSinger();
      this.singerList = data.artists;
    },
    //跳转去歌手详情
    toDetail(id) {
      this.$router.push("/singerInfo/" + id);
    },
  },
};
</script>

<style lang="less" scoped>
.singer_wrap {
  margin: 40px 0;
  display: grid;
  justify-content: space-around;
  align-content: center;
  grid-template-columns: repeat(auto-fill, 14.3rem);
  .item {
    text-align: center;
    .el-image {
      border-radius: 50%;
    }
    .name {
      font-size: 18px;
      font-weight: 600;
      margin-top: 10px;
    }
  }
}
</style>